package com.queue;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @Author: linKe
 * @Date: 2022/1/2 0:38
 * @FileName: SeqQueueTest
 * @version: 1.0
 * @Description: 顺序循环队列测试类
 */
public class SeqQueueTest {

    private SeqQueue<Integer> queue;

    @Before
    public void setUp() throws Exception {
        queue = new SeqQueue<>();
        queue.add(1);
        queue.add(2);
        queue.add(3);

    }

    @Test
    public void isEmpty() {
        boolean empty = queue.isEmpty();
        System.out.println(empty);
        //false
    }

    @Test
    public void add() {
        boolean add = queue.add(4);
        System.out.println(add);
        System.out.println(queue.rear());
        //1 队头的值
        //null  队尾没有填充
    }

    @Test
    public void rear() {
        Integer rear = queue.rear();
        System.out.println(rear);
    }

    @Test
    public void peek() {
        Integer peek = queue.peek();
        System.out.println(peek);
        //1
    }

    @Test
    public void poll() {
        Integer poll = queue.poll();
        System.out.println(poll);
        //1
    }

    @Test
    public void testToString() {
        System.out.println(queue.toString());
        //com.queue.SeqQueue(1,2,3)
    }
}